<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>模范人物表 - 职场观察者知识库</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/lucide@latest"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&family=Source+Han+Sans+CN:wght@300;400;700&display=swap" rel="stylesheet">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#3B82F6',
                        secondary: '#10B981',
                        'highlight-bg': '#EFF6FF',
                        'highlight-text': '#1E40AF',
                    }
                }
            }
        }
    </script>
    <style>
        :root {
            --theme-primary: #3B82F6;
            --theme-secondary: #10B981;
            --highlight-bg: #EFF6FF;
            --highlight-text: #1E40AF;
        }
        body {
            font-family: 'Source Han Sans CN', sans-serif;
            font-weight: 300;
        }
        h1, h2, h3, blockquote {
            font-family: 'Noto Serif SC', serif;
        }
        .magazine-page {
            width: 700px;
            background: #fefefe;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            min-height: auto;
        }
        .dark .magazine-page {
            background: #111827;
        }
        .dark p {
            color: #d1d5db;
        }
        .dark h1, .dark h2, .dark h3 {
            color: #f9fafb;
        }
        .drop-cap::first-letter {
            float: left;
            font-size: 4em;
            line-height: 0.8;
            margin: 0.1em 0.1em 0 0;
            font-weight: 700;
            font-family: 'Noto Serif SC', serif;
        }
        .breathing-space {
            letter-spacing: 0.05em;
            line-height: 1.8;
        }
        .sop-table {
            border-collapse: collapse;
            width: 100%;
            margin-bottom: 1.5rem;
        }
        .sop-table th, .sop-table td {
            border: 1px solid #e5e7eb;
            padding: 0.75rem;
            text-align: left;
        }
        .sop-table th {
            background-color: #f9fafb;
            font-weight: 600;
        }
        .editable {
            min-height: 40px;
            padding: 0.5rem;
            border: 1px dashed #d1d5db;
            border-radius: 0.25rem;
            transition: all 0.3s ease;
        }
        .editable:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
            background-color: #f8fafc;
        }
        .sop-card {
            background: white;
            border-radius: 0.5rem;
            box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
            padding: 1.5rem;
            margin-bottom: 1.5rem;
        }
        .sop-card h3 {
            color: #1e40af;
            border-bottom: 2px solid #e5e7eb;
            padding-bottom: 0.5rem;
            margin-bottom: 1rem;
        }
        .method-explanation {
            background-color: #f0f9ff;
            border-left: 4px solid #3b82f6;
            padding: 1rem;
            margin-bottom: 1.5rem;
            border-radius: 0 0.5rem 0.5rem 0;
        }
        .input-hint {
            font-size: 0.75rem;
            color: #6b7280;
            margin-top: 0.25rem;
        }
        .save-indicator {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background-color: #10b981;
            color: white;
            padding: 0.5rem 1rem;
            border-radius: 0.5rem;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        .save-indicator.show {
            opacity: 1;
        }
    /* 推荐标签样式 - 红底白字 */
.recommend-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #dc2626; /* 红色背景 */
    color: white; /* 白色文字 */
    font-size: 0.65rem;
    font-weight: bold;
    padding: 0.15rem 0.35rem;
    border-radius: 0.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: rotate(8deg);
    z-index: 10;
    white-space: nowrap;
}
.button-with-badge {
    position: relative;
}
    </style>
</head>
<body class="bg-gray-100 dark:bg-gray-800 flex items-center justify-center min-h-screen p-4 md:p-8">
    <article class="magazine-page shadow-2xl p-8">
        <!-- 页面头部 -->
        <header class="mb-8">
            <h1 class="text-3xl font-bold leading-tight mb-2 relative">
                <span class="absolute left-0 -top-2 bottom-2 w-1.5 bg-primary rounded-full"></span>
                <span class="ml-6">模范人物表</span>
            </h1>
            <p class="text-lg text-gray-600 dark:text-gray-400 font-light ml-6">向榜样学习，加速个人成长！</p>
        </header>

        <!-- 方法说明 -->
        <div class="method-explanation">
            <h3 class="font-bold text-primary mb-2">方法简介</h3>
            <p class="text-gray-700">模范人物表帮助您明确想要效仿的榜样，分析他们的成功要素，并制定学习计划，通过向优秀人物学习来加速个人成长。</p>
        </div>

        <!-- 导出按钮 -->
        <div class="flex justify-end mb-6 gap-3">
            <button id="export-pdf" class="bg-red-500 hover:bg-red-600 text-white font-medium py-2 px-4 rounded-lg transition duration-300 flex items-center">
                <i data-lucide="file-text" class="w-5 h-5 mr-2"></i>
                导出为PDF
            </button>
            <button id="export-doc" class="bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition duration-300 flex items-center">
                <i data-lucide="download" class="w-5 h-5 mr-2"></i>
                导出为文档
            </button>
        <!-- 在model.html的导出按钮区域添加这个 -->
<div class="button-with-badge">
    <button id="export-screenshot" class="bg-purple-500 hover:bg-purple-600 text-white font-medium py-2 px-4 rounded-lg transition duration-300 flex items-center">
        <i data-lucide="camera" class="w-5 h-5 mr-2"></i>
        导出长截图
    </button>
    <span class="recommend-badge">推荐</span>
</div>
        </div>

        <!-- 模范人物表 -->
        <div id="sop-content">
            <div class="sop-card">
                <h3 class="text-xl font-bold flex items-center">
                    <i data-lucide="users" class="w-6 h-6 mr-2 text-primary"></i>
                    模范人物表
                </h3>
                
                <div class="mb-6">
                    <label class="block text-sm font-medium text-gray-700 mb-1">填写日期</label>
                    <div class="editable" contenteditable="true" data-placeholder="请输入填写日期..."></div>
                </div>
                
                <table class="sop-table">
                    <thead>
                        <tr>
                            <th width="25%" class="text-center">
                                <div class="flex items-center justify-center">
                                    <i data-lucide="user" class="w-4 h-4 mr-2 text-blue-500"></i>
                                    People you want to emulate<br>想效仿的人物
                                </div>
                            </th>
                            <th width="25%" class="text-center">
                                <div class="flex items-center justify-center">
                                    <i data-lucide="heart" class="w-4 h-4 mr-2 text-red-500"></i>
                                    Reasons<br>想效仿的理由
                                </div>
                            </th>
                            <th width="25%" class="text-center">
                                <div class="flex items-center justify-center">
                                    <i data-lucide="award" class="w-4 h-4 mr-2 text-green-500"></i>
                                    Capabilities<br>想效仿的能力
                                </div>
                            </th>
                            <th width="25%" class="text-center">
                                <div class="flex items-center justify-center">
                                    <i data-lucide="book-open" class="w-4 h-4 mr-2 text-purple-500"></i>
                                    Experience<br>想效仿的经验
                                </div>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>
                                <div class="editable h-40" contenteditable="true" data-placeholder="列出您想效仿的人物姓名..."></div>
                                <div class="input-hint">可以是职场前辈、行业领袖或任何值得学习的人</div>
                            </td>
                            <td>
                                <div class="editable h-40" contenteditable="true" data-placeholder="说明您想效仿他们的原因..."></div>
                                <div class="input-hint">他们哪些特质、成就或价值观吸引您</div>
                            </td>
                            <td>
                                <div class="editable h-40" contenteditable="true" data-placeholder="列出您想学习的具体能力..."></div>
                                <div class="input-hint">专业能力、沟通技巧、领导力等</div>
                            </td>
                            <td>
                                <div class="editable h-40" contenteditable="true" data-placeholder="描述您想获得的经验类型..."></div>
                                <div class="input-hint">项目经验、管理经验、创业经验等</div>
                            </td>
                        </tr>
                    </tbody>
                </table>
                
                <div class="mt-6">
                    <label class="block text-sm font-medium text-gray-700 mb-1">
                        <i data-lucide="target" class="w-4 h-4 mr-1 text-green-500 inline"></i>
                        学习计划与行动
                    </label>
                    <div class="editable" contenteditable="true" data-placeholder="制定具体的学习计划和行动步骤..."></div>
                    <div class="input-hint">如何获取这些能力和经验，具体的时间安排和行动步骤</div>
                </div>
            </div>
            
            <!-- 使用提示 -->
            <div class="sop-card bg-yellow-50 border border-yellow-200">
                <h3 class="text-lg font-bold text-yellow-800 flex items-center">
                    <i data-lucide="lightbulb" class="w-5 h-5 mr-2"></i>
                    使用提示
                </h3>
                <ul class="text-yellow-700 text-sm list-disc pl-5 space-y-1">
                    <li>选择3-5位真正值得学习的榜样，不要过多</li>
                    <li>明确区分他们吸引您的特质和您想学习的能力</li>
                    <li>将能力和经验具体化，避免模糊描述</li>
                    <li>制定切实可行的学习计划，包括时间表和具体行动</li>
                    <li>写的时候不要过于注重格式排版，而应注重内容</li>
                </ul>
            </div>
        </div>

        <!-- 页面底部信息 -->
        <div class="flex items-center text-green-600 mt-8 pt-6 border-t border-gray-200 dark:border-gray-700">
            <i data-lucide="check-circle" class="w-5 h-5 mr-2"></i>
            <span>模范人物表 · 职场观察者知识库工具</span>
        </div>
        
        <!-- 保存提示 -->
        <div id="save-indicator" class="save-indicator">
            <i data-lucide="check" class="w-4 h-4 mr-1 inline"></i>
            内容已自动保存
        </div>
    </article>

    <script>
        // 初始化Lucide图标
        lucide.createIcons();
        
        // 设置占位符文本
        document.querySelectorAll('.editable').forEach(editable => {
            const placeholder = editable.getAttribute('data-placeholder');
            if (placeholder && !editable.textContent.trim()) {
                editable.textContent = placeholder;
                editable.classList.add('text-gray-400');
            }
            
            editable.addEventListener('focus', function() {
                if (this.textContent === this.getAttribute('data-placeholder')) {
                    this.textContent = '';
                    this.classList.remove('text-gray-400');
                }
            });
            
            editable.addEventListener('blur', function() {
                if (!this.textContent.trim()) {
                    this.textContent = this.getAttribute('data-placeholder');
                    this.classList.add('text-gray-400');
                }
            });
            
            // 自动保存功能
            editable.addEventListener('input', function() {
                clearTimeout(this.saveTimeout);
                this.saveTimeout = setTimeout(() => {
                    showSaveIndicator();
                }, 1000);
            });
        });
        
        // 显示保存提示
        function showSaveIndicator() {
            const indicator = document.getElementById('save-indicator');
            indicator.classList.add('show');
            setTimeout(() => {
                indicator.classList.remove('show');
            }, 2000);
        }
        
        // 导出为PDF功能
        document.getElementById('export-pdf').addEventListener('click', function() {
            const { jsPDF } = window.jspdf;
            
            // 获取要导出的内容
            const element = document.getElementById('sop-content');
            
            // 临时移除占位符文本
            document.querySelectorAll('.editable').forEach(editable => {
                if (editable.textContent === editable.getAttribute('data-placeholder')) {
                    editable.textContent = '';
                }
            });
            
            // 使用html2canvas将内容转换为图片
            html2canvas(element, {
                scale: 2,
                useCORS: true,
                logging: false
            }).then(canvas => {
                const imgData = canvas.toDataURL('image/png');
                const pdf = new jsPDF('p', 'mm', 'a4');
                const imgWidth = 190; // 页面宽度
                const pageHeight = 277; // A4高度
                const imgHeight = canvas.height * imgWidth / canvas.width;
                let heightLeft = imgHeight;
                let position = 10;
                
                pdf.addImage(imgData, 'PNG', 10, position, imgWidth, imgHeight);
                heightLeft -= pageHeight;
                
                // 如果内容超过一页，添加新页面
                while (heightLeft >= 0) {
                    position = heightLeft - imgHeight + 10;
                    pdf.addPage();
                    pdf.addImage(imgData, 'PNG', 10, position, imgWidth, imgHeight);
                    heightLeft -= pageHeight;
                }
                
                pdf.save('模范人物表.pdf');
                
                // 恢复占位符文本
                document.querySelectorAll('.editable').forEach(editable => {
                    if (!editable.textContent.trim()) {
                        editable.textContent = editable.getAttribute('data-placeholder');
                        editable.classList.add('text-gray-400');
                    }
                });
            });
        });

        // 导出为文档功能
        document.getElementById('export-doc').addEventListener('click', function() {
            // 创建一个临时的div来保存格式化内容
            const tempDiv = document.createElement('div');
            tempDiv.innerHTML = document.getElementById('sop-content').innerHTML;
            
            // 获取所有可编辑区域的内容
            const editables = tempDiv.querySelectorAll('[contenteditable="true"]');
            editables.forEach(editable => {
                // 移除contenteditable属性
                editable.removeAttribute('contenteditable');
                // 如果内容是占位符，清空
                if (editable.textContent === editable.getAttribute('data-placeholder')) {
                    editable.textContent = '';
                }
                // 添加样式以保持格式
                editable.style.border = '1px solid #ddd';
                editable.style.padding = '8px';
                editable.style.minHeight = '40px';
                editable.style.marginBottom = '10px';
            });
            
            // 创建HTML内容
            const htmlContent = `
                <!DOCTYPE html>
                <html>
                <head>
                    <meta charset="UTF-8">
                    <title>模范人物表</title>
                    <style>
                        body { 
                            font-family: 'Source Han Sans CN', sans-serif; 
                            margin: 20px;
                            color: #333;
                        }
                        h1, h2, h3 { 
                            font-family: 'Noto Serif SC', serif; 
                            color: #1e40af;
                        }
                        h1 { font-size: 24px; border-bottom: 2px solid #1e40af; padding-bottom: 10px; }
                        h3 { font-size: 18px; border-bottom: 1px solid #e5e7eb; padding-bottom: 8px; }
                        .sop-table { 
                            border-collapse: collapse; 
                            width: 100%; 
                            margin-bottom: 20px; 
                        }
                        .sop-table th, .sop-table td { 
                            border: 1px solid #ddd; 
                            padding: 12px; 
                            text-align: left; 
                            vertical-align: top;
                        }
                        .sop-table th { 
                            background-color: #f2f2f2; 
                            font-weight: 600;
                            text-align: center;
                        }
                        .sop-card { 
                            margin-bottom: 30px; 
                            padding: 20px; 
                            border: 1px solid #ddd; 
                            border-radius: 5px; 
                        }
                        .method-explanation {
                            background-color: #f0f9ff;
                            border-left: 4px solid #3b82f6;
                            padding: 15px;
                            margin-bottom: 20px;
                        }
                    </style>
                </head>
                <body>
                    <h1>模范人物表</h1>
                    <div class="method-explanation">
                        <h3>方法简介</h3>
                        <p>模范人物表帮助您明确想要效仿的榜样，分析他们的成功要素，并制定学习计划，通过向优秀人物学习来加速个人成长。</p>
                    </div>
                    ${tempDiv.innerHTML}
                </body>
                </html>
            `;
            
            // 创建Blob并下载
            const blob = new Blob([htmlContent], { type: 'application/msword' });
            const url = URL.createObjectURL(blob);
            const a = document.createElement('a');
            a.href = url;
            a.download = '模范人物表.doc';
            document.body.appendChild(a);
            a.click();
            document.body.removeChild(a);
            URL.revokeObjectURL(url);
        });
    // 在model.html的JavaScript部分最后添加这个功能
// 新增的导出长截图功能 - 只截取中间模块，并隐藏导出按钮
document.getElementById('export-screenshot').addEventListener('click', function() {
    // 获取中间模块内容（不包括页面头部和底部）
    const element = document.getElementById('sop-content');
    
    // 临时移除占位符文本
    document.querySelectorAll('.editable').forEach(editable => {
        if (editable.textContent === editable.getAttribute('data-placeholder')) {
            editable.textContent = '';
        }
    });
    
    // 在截图前添加一个类来隐藏导出按钮
    element.classList.add('hide-export-buttons');
    
    // 使用html2canvas将中间模块转换为图片
    html2canvas(element, {
        scale: 2,
        useCORS: true,
        logging: false,
        backgroundColor: '#ffffff'
    }).then(canvas => {
        // 将canvas转换为图片URL
        const imgData = canvas.toDataURL('image/png');
        
        // 创建下载链接
        const a = document.createElement('a');
        a.href = imgData;
        a.download = '模范人物表_截图.png';
        document.body.appendChild(a);
        a.click();
        document.body.removeChild(a);
        
        // 恢复占位符文本
        document.querySelectorAll('.editable').forEach(editable => {
            if (!editable.textContent.trim()) {
                editable.textContent = editable.getAttribute('data-placeholder');
                editable.classList.add('text-gray-400');
            }
        });
        
        // 移除隐藏导出按钮的类
        element.classList.remove('hide-export-buttons');
    });
});
    </script>
</body>
</html>